<!DOCTYPE html>
<html lang="en">
<head>
    {% block title %}<title>Local Library</title>{% endblock %}
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    {% load static %}
    <link rel="stylesheet" href="{% static 'css/bootstrap.min.css' %}">
    <link rel="stylesheet" href="{% static 'css/styles.css' %}">
    <style>
        body {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
        }

        .container-fluid {
            background: rgba(255, 255, 255, 0.95);
            margin: 20px;
            border-radius: 15px;
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
            backdrop-filter: blur(10px);
            min-height: calc(100vh - 40px);
        }

        .sidebar-nav {
            background: linear-gradient(45deg, #3498db, #2980b9);
            padding: 20px 15px;
            border-radius: 10px;
            margin-top: 20px;
        }

        .sidebar-nav li a {
            color: white !important;
            text-decoration: none;
            padding: 8px 12px;
            display: block;
            border-radius: 5px;
            transition: all 0.3s ease;
        }

        .sidebar-nav li a:hover {
            background: rgba(255, 255, 255, 0.2);
            transform: translateX(5px);
        }

        .sidebar-nav hr {
            border-color: rgba(255, 255, 255, 0.3);
        }

        .col-sm-10 {
            background: rgba(255, 255, 255, 0.8);
            margin-top: 20px;
            border-radius: 10px;
            padding: 30px;
        }

        .pagination {
            background: linear-gradient(45deg, #e74c3c, #c0392b);
            padding: 15px;
            border-radius: 10px;
            margin-top: 20px;
        }

        .pagination a {
            color: white;
            padding: 8px 15px;
            text-decoration: none;
            border-radius: 5px;
            margin: 0 5px;
            background: rgba(255, 255, 255, 0.2);
            transition: all 0.3s ease;
        }

        .pagination a:hover {
            background: rgba(255, 255, 255, 0.3);
            transform: translateY(-2px);
        }

        .current {
            color: white;
            font-weight: bold;
            padding: 8px 15px;
        }
    </style>
</head>
<body>
<div class="container-fluid">
    <div class="row">
        <div class="col-sm-2">
            {% block sidebar %}
                <ul class="sidebar-nav list-unstyled">
                    <li><a href="{% url 'index' %}">🏠 Home</a></li>
                    <li><a href="{% url 'books' %}">📚 All books</a></li>
                    <li><a href="{% url 'authors' %}">✍️ All authors</a></li>

                    {% if user.is_authenticated %}
                        <li style="color: white; padding: 8px 12px;">👤 {{ user.get_username }}</li>
                        <li><a href="{% url 'my-borrowed' %}">📖 My Borrowed</a></li>
                        <li><a href="{% url 'logout' %}">🚪 Logout</a></li>

                        {% if perms.catalog.can_mark_returned %}
                            <li>
                                <hr>
                            </li>
                            <li style="color: white; padding: 8px 12px; font-weight: bold;">👔 Staff</li>
                            <li><a href="{% url 'all-borrowed' %}">📋 All borrowed</a></li>
                            <li><a href="{% url 'book-create' %}">➕ Create book</a></li>
                            <li><a href="{% url 'author-create' %}">➕ Create author</a></li>
                        {% endif %}
                    {% else %}
                        <li><a href="{% url 'login' %}">🔐 Login</a></li>
                        <li><a href="{% url 'signup' %}">📝 Sign up</a></li>
                    {% endif %}
                </ul>
            {% endblock %}
        </div>
        <div class="col-sm-10">
            {% block content %}{% endblock %}

            {% block pagination %}
                {% if is_paginated %}
                    <div class="pagination">
              <span class="page-links">
                {% if page_obj.has_previous %}
                    <a href="?page=1">⏮️ First</a>
                    <a href="?page={{ page_obj.previous_page_number }}">⬅️ Previous</a>
                {% endif %}

                  <span class="current">
                  📄 Page {{ page_obj.number }} of {{ page_obj.paginator.num_pages }}
                </span>

                  {% if page_obj.has_next %}
                      <a href="?page={{ page_obj.next_page_number }}">➡️ Next</a>
                      <a href="?page={{ page_obj.paginator.num_pages }}">⏭️ Last</a>
                  {% endif %}
              </span>
                    </div>
                {% endif %}
            {% endblock %}
        </div>
    </div>
</div>

{% load static %}
<script src="{% static 'js/jquery.min.js' %}"></script>
<script src="{% static 'js/bootstrap.min.js' %}"></script>
</body>
</html> 